

import React, { Component } from 'react';
import {promptBox} from 'nc-lightapp-front';
import './index.less';


class ConfirmModal extends Component {
    constructor(props) {
        super(props);
        this.confirmModal = this.confirmModal.bind(this);
        this.closeModal = this.closeModal.bind(this);
    }
    confirmModal() {
        this.props.confirmOperation();
    }
    closeModal() {
        this.props.cancelOperation();
    }
    render() {
        const { showModal, titile, text, leftText, rightText } = this.props
        return (
            <div>
                {   showModal&&
                    promptBox({
                        content: text,
                        title: titile,
                        beSureBtnName: leftText,
                        cancelBtnName: rightText, 
                        hasCloseBtn: true,
                        beSureBtnClick: this.confirmModal,
                        cancelBtnClick: this.closeModal,
                        closeByClickBackDrop: true

                    })
                }
            </div>
            
            
        )
    }
}

export default ConfirmModal;
